package com.bw.goods.mvvm.adapter;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;

import com.blankj.utilcode.util.ToastUtils;
import com.bw.goods.R;
import com.bw.goods.mvvm.model.entity.HomeMenuEntity;
import com.bw.mvvm_common.BaseApplication;
import com.bw.skill.mvvm.view.SkillActivity;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

public
/**
 * @author Lishaohe
 * @description:
 * @date :2021/10/15 0015 上午 9:31
 *
 */
class HomeMenuAdapter extends BaseQuickAdapter<HomeMenuEntity, BaseViewHolder> {


    public HomeMenuAdapter() {
        super(R.layout.item_home_menu);
    }

    @Override
    protected void convert(  BaseViewHolder baseViewHolder, HomeMenuEntity homeMenuEntity) {
        baseViewHolder.setImageResource(R.id.home_menu_img,homeMenuEntity.iconId);
        baseViewHolder.setText(R.id.home_menu_tv,homeMenuEntity.title);

        ImageView view = baseViewHolder.getView(R.id.home_menu_img);
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (homeMenuEntity.iconId==R.drawable.ic_yundong)
                    BaseApplication.getApplication().startActivity(new Intent(BaseApplication.getApplication()
                    , SkillActivity.class));

            }
        });
    }


}
